package main

import (
	"fmt"
	"net/http"

	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()

	r.GET("/ping", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message.proto": "pong",
		})
	})

	goodsRouter := r.Group("/goods")
	goodsRouter.Use(func(c *gin.Context) {
		fmt.Println("aaaaaa")
		c.Next()
		// c.Abort()
		fmt.Println("cccccc")
	})
	goodsRouter.GET("/list", func(c *gin.Context) {
		c.JSON(http.StatusOK, gin.H{
			"list": "1231231",
		})
	})

	r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
